package com.travelbid.admin.struts.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.web.struts.ActionSupport;

import com.travelbid.admin.dao.TUserDAO;
import com.travelbid.admin.pojo.TUser;
import com.travelbid.admin.struts.form.CreateUserForm;

public class PreEditUserAction extends ActionSupport {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
	
		Integer userId = new Integer(request.getParameter("userId"));
		TUserDAO dao = (TUserDAO)getWebApplicationContext().getBean("TUserDAO");
		
//		CreateUserForm uForm = new CreateUserForm();
		TUser user = dao.findById(new Integer(userId));

		
//		request.setAttribute("uForm", uForm);
		request.setAttribute("user", user);
		return mapping.findForward("EditUser");
	}
}